Explain object oriented analysis and design.
Object-Oriented Analysis and Design (OOAD)​
Object-Oriented Analysis and Design (OOAD) is a software engineering approach that models a system as a group of interacting objects. Each object represents some entity of interest in the system being modeled, and is characterized by its class, its state (data), and its behavior (operations).
Object-Oriented Analysis (OOA)​
Object-Oriented Analysis focuses on understanding the problem domain and requirements of the system. It identifies the objects, their attributes, and behaviors within the problem domain.
Key Activities in OOA:​
-
Identifying Objects and Classes
- Analyze the problem domain to identify real-world entities
- Group similar objects into classes
- Define the purpose and scope of each class
-
Identifying Attributes
- Determine the characteristics (data) that each object must store
- Define the types and constraints for these attributes
-
Identifying Operations
- Define the behaviors (methods) that each object must perform
- Specify how objects interact with each other
-
Identifying Relationships
- Establish associations between objects
- Define inheritance hierarchies
- Identify composition and aggregation relationships
-
Creating Domain Models
- Develop class diagrams representing the problem domain
- Create use case diagrams to capture system functionality
- Build sequence diagrams for dynamic behavior
Object-Oriented Design (OOD)​
Object-Oriented Design transforms the conceptual model created during analysis into a design model that serves as a blueprint for implementation. It focuses on how the system will be built.
Key Activities in OOD:​
-
System Design
- Define the overall architecture of the system
- Organize classes into packages or subsystems
- Establish communication mechanisms between subsystems
-
Object Design
- Refine class definitions with implementation details
- Design interfaces and specific methods
- Define data structures for attributes
- Optimize class relationships for implementation
-
Mechanism Design
- Design how objects will interact during runtime
- Define communication protocols between objects
- Specify exception handling mechanisms
-
User Interface Design
- Design the user interface objects
- Define how UI objects interact with domain objects
-
Data Management Design
- Design persistence mechanisms
- Define database mappings for objects
- Design data access strategies
Core Principles of OOAD​
1. Abstraction​
- Focusing on essential qualities of an entity while ignoring the non-essential details
- Defining objects that represent abstract concepts in the problem domain
2. Encapsulation​
- Hiding the internal state and functionality of an object
- Exposing only what is necessary through well-defined interfaces
- Protecting data integrity and implementation details
3. Inheritance​
- Creating new classes that reuse, extend, and modify the behavior defined in other classes
- Building hierarchical classifications of objects
- Promoting code reuse and establishing "is-a" relationships
4. Polymorphism​
- Allowing objects of different classes to be treated as objects of a common superclass
- Enabling the same interface to be used for different underlying forms
- Supporting method overriding and dynamic binding
OOAD Process​
The OOAD process typically follows these steps:
-
Requirements Gathering
- Collect and analyze user requirements
- Define system scope and constraints
-
Analysis
- Create conceptual models of the problem domain
- Identify objects, relationships, and behaviors
- Develop use cases to capture functionality
-
System Design
- Define the overall architecture
- Organize classes into subsystems
- Design communication mechanisms
-
Object Design
- Detail class specifications
- Design algorithms for methods
- Optimize object relationships
-
Implementation
- Code the classes and relationships
- Implement methods and attributes
- Build the user interface
-
Testing
- Verify object behavior against requirements
- Test interactions between objects
- Validate system functionality
-
Maintenance
- Extend the object model as requirements evolve
- Refine implementations for improved performance
- Fix defects while preserving object integrity
Benefits of OOAD​
- Natural Modeling: Maps closely to real-world entities and concepts
- Modularity: Encapsulated objects create natural modules in the system
- Reusability: Classes can be reused across applications
- Maintainability: Changes are localized to specific objects
- Scalability: New objects can be added with minimal impact
- Parallel Development: Team members can work on different classes simultaneously
- Quality: Promotes robust, well-structured designs
OOAD Notations and Tools​
-
Unified Modeling Language (UML)
- Class diagrams
- Use case diagrams
- Sequence diagrams
- Activity diagrams
- State diagrams
- Component diagrams
- Deployment diagrams
-
CASE Tools
- Visual modeling tools
- Code generation capabilities
- Reverse engineering features
- Documentation generators
Real-World Example: Library Management System​
Object-Oriented Analysis:​
-
Identify Classes:
- Book, Member, Librarian, Catalog, Loan, Reservation
-
Identify Attributes:
- Book: ISBN, title, author, publisher, status
- Member: ID, name, address, phone, email, loans
- Loan: book, borrower, date borrowed, due date
-
Identify Operations:
- Book: checkOut(), return(), reserve()
- Member: borrowBook(), returnBook(), payFine()
- Librarian: addBook(), removeBook(), processReturn()
-
Identify Relationships:
- Member borrows Books (1-to-many)
- Librarian manages Books (many-to-many)
- Book has a Loan status (1-to-1)
Object-Oriented Design:​
-
Class Design:
public class Book {
private String isbn;
private String title;
private String author;
private BookStatus status;
public void checkOut(Member member) {
if (status == BookStatus.AVAILABLE) {
// Create new loan
// Update status
}
}
public void returnBook() {
// Update status
// Process any waiting reservations
}
}
public class Member {
private String id;
private String name;
private List<Loan> currentLoans;
public boolean borrowBook(Book book) {
if (currentLoans.size() < LOAN_LIMIT) {
// Process loan
return true;
}
return false;
}
} -
System Design:
- Authentication Subsystem
- Catalog Management Subsystem
- Loan Processing Subsystem
- Reservation Subsystem
- Member Management Subsystem
-
User Interface Design:
- Search interface
- Member dashboard
- Librarian administrative console
Object-Oriented Analysis and Design provides a comprehensive approach to understanding complex systems and translating that understanding into a structured, maintainable implementation. By focusing on objects that mirror real-world entities, OOAD creates systems that are more intuitive and adaptable to changing requirements.